{% extends 'layout.html' %}

{% block content %}
    <div class="table">
        <div class="add_btn">
            <a href="{% url 'level_add' %}" class="btn btn-success">
                <i class="fas fa-plus-circle"></i>
                <span> 添加</span>
            </a>
        </div>

        <table class="table table-bordered">
            <thead>
            <tr>
                <th>ID</th>
                <th>标题</th>
                <th>折扣</th>
                <th>操作</th>
            </tr>
            </thead>
            <tbody>
            {% for item in queryset %}
                <tr>
                    <th scope="row">{{ item.id }}</th>
                    <td>{{ item.title }}</td>
                    <td>{{ item.percent }}%</td>
                    <td>
                        <a href="{% url 'level_edit' pk=item.id %}" class="btn btn-xs btn-primary">编辑</a>
                        <a href="{% url 'level_delete' pk=item.id %}" class="btn btn-xs btn-danger">删除</a>
                    </td>
                </tr>
            {% endfor %}
            </tbody>
        </table>
    </div>
{% endblock %}